FROM php:8.2.17-zts-bullseye

RUN sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list \
	&& apt-get update && apt-get install -y \
		libfreetype-dev \
		libjpeg62-turbo-dev \
		libpng-dev \
		libzip-dev \
	&& rm -rf /var/lib/apt/lists/* \
	&& docker-php-ext-configure gd --with-freetype --with-jpeg \
	&& docker-php-ext-install -j$(nproc) gd \
	&& docker-php-ext-install zip mysqli pdo pdo_mysql bcmath calendar gettext opcache \
	&& docker-php-ext-install pcntl \
	&& pecl install redis-5.3.7 \
	&& pecl install xdebug-3.2.1 \
	&& docker-php-ext-enable redis xdebug \
	&& docker-php-source delete \
	&& cd /usr/local/etc/php/conf.d/ \
	&& echo "" >> docker-php-ext-xdebug.ini \
	&& echo "[xdebug]" >> docker-php-ext-xdebug.ini \
	&& echo "xdebug.mode=debug" >> docker-php-ext-xdebug.ini \
	&& echo "xdebug.client_host='host.docker.internal'" >> docker-php-ext-xdebug.ini \
	&& echo "xdebug.start_with_request=yes" >> docker-php-ext-xdebug.ini

